// part1:C12:12:32:my_TextQuery.h
#ifndef TEXTQUERY_H__
#define TEXTQUERY_H__
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include "my_QueryResult.h"
/*
 * this version of the query classes includes two
 * memory not covered in the book:
 * cleanup_str: which removes punctuation and
 *     converst all text to lowercase
 * display_map: a debugging routine that will print the contents
 *     of the lookpu mape
 */

class QueryResult;
class TextQuery
{
public:
  using line_no = std::vector<std::string>::size_type;
  TextQuery(std::ifstream&);
  QueryResult query(const std::string&) const;
  void display_map();
private:
  StrBlob file;
  // each word map to their line set.
  std::map<std::string,
           std::shared_ptr<std::set<line_no>>> wm;
  // delete punctuation, transform to lowercase.
  static std::string cleanup_str(const std::string&);
};
#endif
